#include "LambertianShader.h"
#include "Constants.h"
#include <algorithm>

using namespace std;

LambertianShader::LambertianShader(double r, double g, double b) {
    surfaceColor.set(r, g, b);
}

cs5721::Vector3D LambertianShader::calcColor(cs5721::Vector3D& intensity,
        cs5721::Vector3D& light, cs5721::Vector3D& normal, cs5721::Vector3D& view) {

    double red = surfaceColor[0] * intensity[0] * max(0.0, normal.dot(light));
    double green = surfaceColor[1] * intensity[1] * max(0.0, normal.dot(light));
    double blue = surfaceColor[2] * intensity[2] * max(0.0, normal.dot(light));

    return cs5721::Vector3D(red, green, blue);
}

cs5721::Vector3D LambertianShader::getSurfaceColor() {
    return surfaceColor;
}

double LambertianShader::getMirrorCoef() {
    return 0.0;
}